using System.Diagnostics;
using System.IO;
using System.Reflection;

namespace Isis.Helpers
{
    public class AssemblyInfo
    {
        public bool IsAssemblyDebugBuild(string filepath)
        {
            return IsAssemblyDebugBuild(Assembly.LoadFile(Path.GetFullPath(filepath)));
        }

        public bool IsAssemblyDebugBuild(Assembly assembly)
        {
            foreach (var attribute in assembly.GetCustomAttributes(false))
            {
                var debuggableAttribute = attribute as DebuggableAttribute;
                if (debuggableAttribute != null)
                {
                    return debuggableAttribute.IsJITTrackingEnabled;
                }
            }
            return false;
        }

    }
}